<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>百度文库下载器</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="/static/uikit-2.25.0/css/uikit.min.css" />
    <script src="/static/jquery-2.1.4.js"></script>
    <script src="/static/uikit-2.25.0/js/uikit.min.js"></script>
</head>
<style>
    html:{
        width:100%;
        height:100%;
    }
</style>
<body>

<form class="uk-form" action="/download" method="post">

    <fieldset data-uk-margin>
        <legend>百度文库下载器</legend>
        <div class="uk-form-row">
            <input class="uk-form-large uk-form-width-large" type="text" name="url" placeholder="请输入百度文库url">
            <label><input checked="checked" type="checkbox" class="download" name="download">是否下载</label>
            <button class="submit uk-button uk-form-large">提交</button>
        </div>

        <div class="uk-form-row">
            <textarea class="out uk-form-large uk-button uk-form-large" style="width:80%;height:500px"></textarea>
        </div>

    </fieldset>

</form>
<script>

    var baseurl="http://"+location.host+"/";;
    $(".submit").click(function(e){
        var url=$("input[name='url']").val();
        console.log(url);
        $.ajax({
            url:baseurl+"download",
            type:"POST",
            data:{
                url:url
            },
            success:function(res){
                $(".out").text(res);
            }
        });
    });


</script>
</body>
</html>